package cn.ylg.com.database;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {
    EditText ed_name, ed_age, ed_date;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ed_age = (EditText) findViewById(R.id.ed_age);
        ed_date = (EditText) findViewById(R.id.ed_date);
        ed_name = (EditText) findViewById(R.id.ed_name);
    }
    public void saveStudent(View view) {

        String name = ed_name.getText().toString();
        int age = Integer.valueOf(ed_age.getText().toString());
        String date = ed_date.getText().toString();
        Student student = new Student(name, age, date);
        long count =  StudentDbUtils.getInstance(this).writeStudent(student);
        Log.d("xxxx", "新条数据id 为 。。。 "+count);
    }
}
